The revision_table Script

The revision_table script contains the definition parameters for the revision table that the user can open from File > Document > Edit Revision Table.

There can be several revision tables and they can all be defined in this script. The location and the name of the revision table is given either in the 'sheets' script of the example project or directly from [project or library] > Diagram > Startup Scripts.

The fields of the revision table can be added with predefined tags. The tags need to be added to the SQL CADMATIC_SYSTEM_COLUMNS table with TableName value PI_CATALOG. After this they are visible in the Manage Revisions dialog.

You can find an example revision table in the library of the CADMATIC example project, in Resources > Scripts > pd > revision_table.

The script must include the file PdRevisionTable.h.

The fields of the revision_table script are described below.

pd_revision_table_name (name)

Sets the name of the table.

When you recreate a table, the application removes all tables that have the same name. The default name is "RevisionTable".

If you have more than one table in same drawing, then you must define a separate name for each additional table, otherwise this command is not needed.

pd_set_revision_table_fill_direction (dir)

FILL_FROM_UP_TO_DOWN 0 fill from up to down
FILL_FROM_DOWN_TO_UP 1 fill from down to up
FILL_FROM_RIGHT_TO_LEFT 2 fill from right to left
FILL_FROM_LEFT_TO_RIGHT 3 fill from left to right

pd_set_revision_table_orig (x,y)

FILL_FROM_UP_TO_DOWN upper left corner of table
FILL_FROM_DOWN_TO_UP lower left corner of table
FILL_FROM_RIGHT_TO_LEFT lower left corner of table
FILL_FROM_LEFT_TO_RIGHT lower right corner of table

pd_set_number_revision_table_rows (nr)

The 'nr' argument defines the number of rows in the revision table. If there are less rows than revisions, then only the last revisions are shown in the available space.

pd_show_revision_table_tag_names (show)

The 'show' argument defines whether the name of the field is shown in the first row of the revision table.

1 show
0 hide

pd_show_revision_table_lines (show)

The 'show' argument defines whether empty rows are shown in the revision table.

SHOW_ONLY_LINES_WITH_REVISION_DATA 0 show only the lines that contain revision information.

SHOW_ALL_LINES 1 show all lines (defined in the pd_set_number_revision_table_rows function).

pd_set_revision_table_field (tag, name, lower_left_x, lower_left_y, upper_right_x, upper_right_y, format, orig, text_h, text_w, text_s)

Argument

tag tag which will be shown in this field
name name of the field
lower_left_x lower left corner of the field (from table origin)
lower_left_y lower left corner of the field (from table origin)
upper_right_x upper right corner of the field (from table origin)
upper_right_y upper right corner of the field (from table origin)
format format of the field (time etc.)
orig text orig: TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_RIGHT
text_h height of the text in this field
text_w width of the text in this field (0 then use default)
text_s space of the text in this field (0 then use default)

pd_set_revision_table_layer (layer_of_lines, layer_of_text, layer_of_header)

This sets the layer for lines and text.

pd_set_revision_table_pen (pen_of_lines, pen_of_text, pen_of_header)

This sets the pen for lines and text.

pd_draw_revision_table (color_of_lines, color_of_text, color_of_header)

When the table is defined, call this function which removed the previous revision table and then draw a new one with the defined color.

Example Revision Table Script

Copy
#include include/PdRevisionTable.h
REVISIONTABLE(x, y, group)            
{
    pd_set_revision_table_orig( x, y );
    pd_set_revision_table_fill_direction( 0 ); /* up to down 0, down to up 1, right to left 2, left to right 3*/
    pd_set_number_revision_table_rows( 5 );
    pd_show_revision_table_tag_names( 1 );
    pd_revision_table_name( "RevisionCAD" );
    pd_revision_table_group( group );
    pd_show_revision_table_lines( 0 );
    pd_set_revision_table_field( DM_COSE_DOC_REV_MARK, "Rev", 0, 0, 15, 5, "", TEXT_ALIGMENT_CENTER, 3.3, 2.0, .1 );
    pd_set_revision_table_field( DM_COSE_DOC_REV_TIME, "Date", 15, 0, 50, 5, "1", TEXT_ALIGMENT_LEFT, 3.3, 2.0, .1 );
    pd_set_revision_table_field( DM_COSE_DOC_REV_DESIGNED_BY, "By", 50, 0, 70, 5, "", TEXT_ALIGMENT_LEFT, 3.3, 2.0, .1 );
    pd_set_revision_table_field( DM_COSE_DOC_REV_CHECKED_BY, "ChkdBy", 70, 0, 90, 5, "", TEXT_ALIGMENT_LEFT, 3.3, 2.0, .1 );
    pd_set_revision_table_field( DM_COSE_DOC_REV_REASON, "Info", 90, 0, 185, 5, "", TEXT_ALIGMENT_LEFT, 3.3, 2.0, .1 );
    pd_set_revision_table_layer( 65004, 65005, 65005 ); /* lines, text, header */
    pd_set_revision_table_pen( 3, 3, 3 ); /* lines, text, header */
    pd_draw_revision_table( 11, 11, 11 ); /* color lines, text, header */
}